<style>
  .pagination {
    justify-content: center;
  }
</style>
<!--页面主要内容-->
<main class="lyear-layout-content">

  <div class="container-fluid p-t-15">

    <div class="row">
      <div class="col-lg-12">
        <div class="card">
          <div class="card-toolbar d-flex flex-column flex-md-row">
            <form class="search-bar ml-md-auto" method="get" role="form">
              <input type="hidden" name="search_field" id="search-field" value="nickname" />
              <div class="input-group ml-md-auto">
                <div class="input-group-prepend">
                  <button class="btn btn-default dropdown-toggle" type="button" data-toggle="dropdown"
                    aria-haspopup="true" aria-expanded="false" id="search-btn">用户昵称</button>
                  <div class="dropdown-menu">
                    <a class="dropdown-item" href="javascript:void(0);" data-field="nickname">用户昵称</a>
                  </div>
                </div>
                <input type="text" class="form-control" name="keyword" placeholder="请输入关键字" value="{$keyword}">
              </div>
            </form>
          </div>
          <div class="card-body">

            <div class="table-responsive">
              <table class="table table-bordered">
                <thead>
                  <tr>
                    <th>
                      <div class="custom-control custom-checkbox">
                        <input type="checkbox" class="custom-control-input" id="check-all">
                        <label class="custom-control-label" for="check-all"></label>
                      </div>
                    </th>
                    <th>编号</th>
                    <th>用户昵称</th>
                    <th>消费记录</th>
                    <th>消费类型</th>
                    <th>积分变化</th>
                    <th>消费时间</th>
                  </tr>
                </thead>
                <tbody>
                  {foreach $RecordList as $key => $item}
                  <tr>
                    <td>
                      <div class="custom-control custom-checkbox">
                        <input type="checkbox" class="custom-control-input ids" name="ids[]" value="{$item['id']}"
                          id="ids-{$item['id']}">
                        <label class="custom-control-label" for="ids-{$item['id']}"></label>
                      </div>
                    </td>
                    <td>{$key + ($page - 1) * $num + 1}</td>
                    <td>{$item.user.nickname}</td>
                    <td>{$item['content']}</td>
                    <td>{$item['state_text']}</td>
                    <td>{$item['point']}</td>
                    <td>{$item['createtime']|date='Y-m-d'}</td>
                  </tr>
                  {/foreach}
                </tbody>
              </table>
            </div>
            <!-- 分页 -->
            {$RecordList|raw}
          </div>
        </div>
      </div>
    </div>
  </div>
</main>
<!--End 页面主要内容-->

<script>
  $('.search-bar .dropdown-menu a').click(function () {
    var field = $(this).data('field') || '';
    $('#search-field').val(field);
    $('#search-btn').html($(this).text());
  });
</script>